<template>
  <div>
    <!-- 使用三级联动全局组件 -->
    <TypeNav />
    <ListContainer />
    <TodayRecommend />
    <Rank />
    <Like />
    <Floor v-for="(floor, index) in floorList" :key="floor.id" :floor="floor" />
    <Brand />
  </div>
</template>

<script>
// 引入轮播图/快报栏模块
import ListContainer from './ListContainer/'
// 引入今日推荐模块
import TodayRecommend from './TodayRecommend/'
// 引入Rank组件
import Rank from './Rank'
// 引入猜您喜欢组件
import Like from './Like'
// 引入楼层组件
import Floor from './Floor'
// 引入商标组件
import Brand from './Brand'
// 引入vuex映射辅助函数
import { mapState } from 'vuex'


export default {
  name: 'Home',
  // 注册局部组件
  components: { ListContainer, TodayRecommend, Rank, Like, Floor, Brand },
  computed: {
    // 将store/home下的floorList数据映射到当前组件中
    ...mapState({
      floorList: state => state.home.floorList
    })
  },
  mounted () {
    // 请求floor数据
    this.$store.dispatch('reqFloorList');

  }
}
</script>

<style scoped lang="less">
</style>
